import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { IndustryVO, IndustryForm, IndustryQuery } from '@/api/logic/industry/types';

/**
 * 查询行业管理列表
 * @param query
 * @returns {*}
 */

export const listIndustry = (query?: IndustryQuery): AxiosPromise<IndustryVO[]> => {
  return request({
    url: '/logic/industry/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询行业管理详细
 * @param industryId
 */
export const getIndustry = (industryId: string | number): AxiosPromise<IndustryVO> => {
  return request({
    url: '/logic/industry/' + industryId,
    method: 'get'
  });
};

/**
 * 新增行业管理
 * @param data
 */
export const addIndustry = (data: IndustryForm) => {
  return request({
    url: '/logic/industry',
    method: 'post',
    data: data
  });
};

/**
 * 修改行业管理
 * @param data
 */
export const updateIndustry = (data: IndustryForm) => {
  return request({
    url: '/logic/industry',
    method: 'put',
    data: data
  });
};

/**
 * 删除行业管理
 * @param industryId
 */
export const delIndustry = (industryId: string | number | Array<string | number>) => {
  return request({
    url: '/logic/industry/' + industryId,
    method: 'delete'
  });
};
